home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12855 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  85 lines

  1. Path: in1.uu.net!interaccess!usenet
  2. From: brianmcg@interaccess.com (Brian V. McGroarty)
  3. Newsgroups: comp.lang.c,comp.lang.c++
  4. Subject: Re: I dont want BIOS to get the keystrokes..
  5. Date: 22 Mar 1996 01:57:32 GMT
  6. Organization: Internet Squire
  7. Message-ID: <4it1ec$a7h@nntp.interaccess.com>
  8. References: <4imdph$497@dos.canit.se>
  9. Reply-To: brianmcg@interaccess.com
  10. NNTP-Posting-Host: d216.nhe.interaccess.com
  11. X-Newsreader: Internet Squire 1.20
  12.  
  13. If you aren't going to pass a key to the BIOS to handle, you must still
  14. acknowledge the receipt of the key to keep the keyboard hardware happy. 
  15. The code to do that is as follows:
  16.  
  17. asm {
  18.     in   al,0x61
  19.     mov  ah,al
  20.     or   al,0x80
  21.     out  0x61,al
  22.     xchg al,ah
  23.     out  0x61,al
  24. }
  25.  
  26. ..or -
  27.     char temp;
  28.  
  29.     temp= inportb( 0x61 );
  30.     outportb( 0x61, temp | 0x80 );
  31.     outportb( 0x61, temp );
  32.  
  33. Note that before you do this you may want to read the current character
  34. from port 0x60.
  35.  
  36.  
  37. ps. -- This is a fairly PC-specific question -- you might get fastest
  38. results with this sort of question by posting to an MS-DOS programming
  39. group.
  40.  
  41.  
  42.  
  43.  
  44. Stefan Ottosson wrote:
  45. >why doesn4t this work:?  ( Borland C++)
  46.  
  47. [...]
  48.  
  49. >void interrupt keyb(__CPPARGS)
  50. >{
  51. >n++;
  52. >}
  53.  
  54. >int main()
  55. >{
  56. >oldhandler = getvect(BIOSINT);
  57. >setvect(BIOSINT,keyb);
  58. >while (n < 30) {};
  59. >setvect(BIOSINT,oldhandler);
  60. >return 0;
  61. >}
  62.  
  63.  
  64.  
  65.  
  66. >what I4m trying to do is to take over interupt 9h and do nothing until
  67. >the interupt has been called 30 times, and then return to dos..
  68. >It works if I call oldhandler() in keyb(), but I dont want to give the
  69. >keystrokes to BIOS!!
  70.  
  71.  
  72.  
  73.  
  74. Take care!
  75.  
  76.  
  77.  
  78. ---
  79. Brian Valters McGroarty -- brianmcg@bix.com
  80. phone/fax (847) 439-7714
  81.  
  82.  
  83.  
  84.  
  85.